version 12.1

******************  Online Appendix
******** FIGURE A1 Marginal effects of candidate attributes for different socio-demographic traits of respondents
use data.dta, clear

***** Setting the mean or modal values for the respondent-level variables
* pol_interest = 3.3
sum pol_interest if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_pinterest=3.3
* left_right = 4.2
sum left_right if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_leftright=4.2
* gender =0 (female)
table gender if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_gender=0
* age = 21.4
sum age if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_age=21.4
* italian = 1
table italian if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_italian=1
* student = 1
table ftstudent if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_student=1
* lyceum = 1
table lyceum if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_lyceum=1
* edu_imp = 3.1
sum edu_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_eduimp=3.1
* inc_imp = 1.9
sum inc_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_incimp=1.9
* hon_imp = 3.9
sum hon_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_honimp=3.9
* taxspend_imp = 3.7
sum taxspend_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & taxspend_imp!=. & samesex_imp!=. & Y!=.
scalar h_taximp=3.7
* samesex_imp = 3.4
sum samesex_imp if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & taxspend_imp!=. & samesex_imp!=. & Y!=.
scalar h_sseximp=3.4 
* survey =1 (2013)
table survey if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_survey=1

* Note: Non-varying candidate attributes are set at their baseline values (junior high school diploma, low income, clean, more taxation and spending, same rights to same sex-couples)

*********************************  Marginal effects by GENDER
** Average marginal effects graph
**********   EDUCATION
* Education: High school vs. Middle-junior high
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b2 + MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*(`a') + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student ///
+ MG_b52*h_lyceum + MG_b58*h_eduimp + MG_b100 + MG_b109 + MG_b114*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace

* Education: University vs. Middle-junior high
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b3 + MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*(`a') + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student ///
+ MG_b53*h_lyceum + MG_b59*h_eduimp + MG_b103 + MG_b112 + MG_b115*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   INCOME
* Income: Middle vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b5 + MG_b18*h_pinterest + MG_b24*h_leftright + MG_b30*(`a') + MG_b36*h_age + MG_b42*h_italian + MG_b48*h_student ///
+ MG_b54*h_lyceum + MG_b60*h_incimp + MG_b116*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Income: High vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b6 + MG_b19*h_pinterest + MG_b25*h_leftright + MG_b31*(`a') + MG_b37*h_age + MG_b43*h_italian + MG_b49*h_student ///
+ MG_b55*h_lyceum + MG_b61*h_incimp + MG_b117*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   CORRUPTION
* Corruption: Investigated vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b8 + MG_b20*h_pinterest + MG_b26*h_leftright + MG_b32*(`a') + MG_b38*h_age + MG_b44*h_italian + MG_b50*h_student ///
+ MG_b56*h_lyceum + MG_b62*h_honimp + MG_b118*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Corruption: Corrupt vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b9 + MG_b21*h_pinterest + MG_b27*h_leftright + MG_b33*(`a') + MG_b39*h_age + MG_b45*h_italian + MG_b51*h_student ///
+ MG_b57*h_lyceum + MG_b63*h_honimp + MG_b119*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   TAX AND SPEND
* Taxspend: Maintain vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b11 + MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*(`a') + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student ///
+ MG_b88*h_lyceum + MG_b92*h_taximp + MG_b100 + MG_b120*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b12 + MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*(`a') + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student ///
+ MG_b89*h_lyceum + MG_b93*h_taximp + MG_b101 + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   SAME SEX RIGHTS
* Same sex: Some rights vs Same rights
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b14 + MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*(`a') + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student ///
+ MG_b90*h_lyceum + MG_b94*h_sseximp + MG_b109 + MG_b122*h_survey
* 'high school diploma' candidate, for a candidate with 'university' degree replace MG_b109 with MG_b112
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b15 + MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*(`a') + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student ///
+ MG_b91*h_lyceum + MG_b95*h_sseximp + MG_b110 + MG_b123*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
gen MV = _n
save sim2.dta, replace

eclplot diff_hat diff_hi diff_lo MV, hor estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) ysca(noline) ytitle ("") xtitle(Marginal effect, size(3)) ///
ylabel(1 "Education (high v. jr): female" 2 ": male" 3 "Education (university v. jr): female" 4 ": male" 5 "Income (middle v. low): female" 6 ": male" 7 "Income (high v. low): female" 8 ": male" ///
9 "Corruption (investigated v. clean): female" 10 ": male" 11 "Corruption (corrupt v. clean): female" 12 ": male" 13 "Tax-spend (constant v. more): female" 14 ": male" 15 "Tax-spend (less v. more): female" 16 ": male" ///
17 "Same-sex rights (some v. same): female" 18 ": male" 19 "Same-sex rights (none v. same): female" 20 ": male", noticks labsize(2)) ///
xlabel(.5 "0.5" .25 "0.25" 0 -.25 "-0.25" -.5 "-0.5", noticks labsize(2)) xline(0, lcolor(black) lwidth(medthin)) saving(ME_gender, replace)

*********************************  Marginal effects by NATIONALITY
** Average marginal effects graph
**********   EDUCATION
* Education: High school vs, Middle-junior high
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b2 + MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*(`a') + MG_b46*h_student ///
+ MG_b52*h_lyceum + MG_b58*h_eduimp + MG_b100 + MG_b109 + MG_b114*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace

* Education: University vs. Middle-junior high
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b3 + MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*(`a') + MG_b47*h_student ///
+ MG_b53*h_lyceum + MG_b59*h_eduimp + MG_b103 + MG_b112 + MG_b115*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   INCOME
* Income: Middle vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b5 + MG_b18*h_pinterest + MG_b24*h_leftright + MG_b30*h_gender + MG_b36*h_age + MG_b42*(`a') + MG_b48*h_student ///
+ MG_b54*h_lyceum + MG_b60*h_incimp + MG_b116*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Income: High vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b6 + MG_b19*h_pinterest + MG_b25*h_leftright + MG_b31*h_gender + MG_b37*h_age + MG_b43*(`a') + MG_b49*h_student ///
+ MG_b55*h_lyceum + MG_b61*h_incimp + MG_b117*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   CORRUPTION
* Corruption: Investigated vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b8 + MG_b20*h_pinterest + MG_b26*h_leftright + MG_b32*h_gender + MG_b38*h_age + MG_b44*(`a') + MG_b50*h_student ///
+ MG_b56*h_lyceum + MG_b62*h_honimp + MG_b118*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Corruption: Corrupt vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b9 + MG_b21*h_pinterest + MG_b27*h_leftright + MG_b33*h_gender + MG_b39*h_age + MG_b45*(`a') + MG_b51*h_student ///
+ MG_b57*h_lyceum + MG_b63*h_honimp + MG_b119*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   TAX AND SPEND
* Taxspend: Maintain vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b11 + MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*(`a') + MG_b84*h_student ///
+ MG_b88*h_lyceum + MG_b92*h_taximp + MG_b100 + MG_b120*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b12 + MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*(`a') + MG_b85*h_student ///
+ MG_b89*h_lyceum + MG_b93*h_taximp + MG_b101 + MG_b121*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   SAME SEX RIGHTS
* Same sex: Some rights vs Same rights
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b14 + MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*(`a') + MG_b86*h_student ///
+ MG_b90*h_lyceum + MG_b94*h_sseximp + MG_b109 + MG_b122*h_survey
* 'high school diploma' candidate, for a candidate with 'university' degree replace MG_b109 with MG_b112
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b15 + MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*(`a') + MG_b87*h_student ///
+ MG_b91*h_lyceum + MG_b95*h_sseximp + MG_b110 + MG_b123*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
gen MV = _n
save sim2.dta, replace

eclplot diff_hat diff_hi diff_lo MV, hor estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) ysca(noline) ytitle ("") xtitle(Marginal effect, size(3)) ///
ylabel(1 "Education (high v. jr): foreign" 2 ": italian" 3 "Education (university v. jr): foreign" 4 ": italian" 5 "Income (middle v. low): foreign" 6 ": italian" 7 "Income (high v. low): foreign" 8 ": italian" ///
9 "Corruption (investigated v. clean): foreign" 10 ": italian" 11 "Corruption (corrupt v. clean): foreign" 12 ": italian" 13 "Tax-spend (constant v. more): foreign" 14 ": italian" 15 "Tax-spend (less v. more): foreign" 16 ": italian" ///
17 "Same-sex rights (some v. same): foreign" 18 ": italian" 19 "Same-sex rights (none v. same): foreign" 20 ": italian", noticks labsize(2)) ///
xlabel(.5 "0.5" .25 "0.25" 0 -.25 "-0.25" -.5 "-0.5", noticks labsize(2)) xline(0, lcolor(black) lwidth(medthin)) saving(ME_italian, replace)

*********************************  Marginal effects by SECONDARY SCHOOL
** Average marginal effects graph
**********   EDUCATION
* Education: High school vs, Middle-junior high
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b2 + MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*h_student ///
+ MG_b52*(`a') + MG_b58*h_eduimp + MG_b100 + MG_b109 + MG_b114*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace

* Education: University vs. Middle-junior high
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b3 + MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*h_student ///
+ MG_b53*(`a') + MG_b59*h_eduimp + MG_b103 + MG_b112 + MG_b115*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   INCOME
* Income: Middle vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b5 + MG_b18*h_pinterest + MG_b24*h_leftright + MG_b30*h_gender + MG_b36*h_age + MG_b42*h_italian + MG_b48*h_student ///
+ MG_b54*(`a') + MG_b60*h_incimp + MG_b116*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Income: High vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b6 + MG_b19*h_pinterest + MG_b25*h_leftright + MG_b31*h_gender + MG_b37*h_age + MG_b43*h_italian + MG_b49*h_student ///
+ MG_b55*(`a') + MG_b61*h_incimp + MG_b117*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   CORRUPTION
* Corruption: Investigated vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b8 + MG_b20*h_pinterest + MG_b26*h_leftright + MG_b32*h_gender + MG_b38*h_age + MG_b44*h_italian + MG_b50*h_student ///
+ MG_b56*(`a') + MG_b62*h_honimp + MG_b118*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Corruption: Corrupt vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b9 + MG_b21*h_pinterest + MG_b27*h_leftright + MG_b33*h_gender + MG_b39*h_age + MG_b45*h_italian + MG_b51*h_student ///
+ MG_b57*(`a') + MG_b63*h_honimp + MG_b119*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   TAX AND SPEND
* Taxspend: Maintain vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b11 + MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*h_student ///
+ MG_b88*(`a') + MG_b92*h_taximp + MG_b100 + MG_b120*h_survey
* 'high school diploma' candidate, for a candidate with 'university' degree replace MG_b100 with MG_b103
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b12 + MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*h_student ///
+ MG_b89*(`a') + MG_b93*h_taximp + MG_b101 + MG_b121*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   SAME SEX RIGHTS
* Same sex: Some rights vs Same rights
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b14 + MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*h_student ///
+ MG_b90*(`a') + MG_b94*h_sseximp + MG_b109 + MG_b122*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b15 + MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*h_student ///
+ MG_b91*(`a') + MG_b95*h_sseximp + MG_b110 + MG_b123*h_survey
* 'high school diploma' candidate, for a candidate with 'university' degree replace MG_b110 with MG_b113
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
gen MV = _n
save sim2.dta, replace

eclplot diff_hat diff_hi diff_lo MV, hor estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) ysca(noline) ytitle ("") xtitle(Marginal effect, size(3)) ///
ylabel(1 "Education (high v. jr): other" 2 ": lyceum" 3 "Education (university v. jr): other" 4 ": lyceum" 5 "Income (middle v. low): other" 6 ": lyceum" 7 "Income (high v. low): other" 8 ": lyceum" ///
9 "Corruption (investigated v. clean): other" 10 ": lyceum" 11 "Corruption (corrupt v. clean): other" 12 ": lyceum" 13 "Tax-spend (constant v. more): other" 14 ": lyceum" 15 "Tax-spend (less v. more): other" 16 ": lyceum" ///
17 "Same-sex rights (some v. same): other" 18 ": lyceum" 19 "Same-sex rights (none v. same): other" 20 ": lyceum", noticks labsize(2)) ///
xlabel(.5 "0.5" .25 "0.25" 0 -.25 "-0.25" -.5 "-0.5", noticks labsize(2)) xline(0, lcolor(black) lwidth(medthin)) saving(ME_lyceum, replace)

*********************************  Marginal effects by FULL-TIME STUDENT STATUS
** Average marginal effects graph
**********   EDUCATION
* Education: High school vs, Middle-junior high
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b2 + MG_b16*h_pinterest + MG_b22*h_leftright + MG_b28*h_gender + MG_b34*h_age + MG_b40*h_italian + MG_b46*(`a') ///
+ MG_b52*h_lyceum + MG_b58*h_eduimp + MG_b100 + MG_b109 + MG_b114*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace

* Education: University vs. Middle-junior high
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b1
generate x_betahat1 = MG_b3 + MG_b17*h_pinterest + MG_b23*h_leftright + MG_b29*h_gender + MG_b35*h_age + MG_b41*h_italian + MG_b47*(`a') ///
+ MG_b53*h_lyceum + MG_b59*h_eduimp + MG_b103 + MG_b112 + MG_b115*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   INCOME
* Income: Middle vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b5 + MG_b18*h_pinterest + MG_b24*h_leftright + MG_b30*h_gender + MG_b36*h_age + MG_b42*h_italian + MG_b48*(`a') ///
+ MG_b54*h_lyceum + MG_b60*h_incimp + MG_b116*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Income: High vs Low
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b4
generate x_betahat1 = MG_b6 + MG_b19*h_pinterest + MG_b25*h_leftright + MG_b31*h_gender + MG_b37*h_age + MG_b43*h_italian + MG_b49*(`a') ///
+ MG_b55*h_lyceum + MG_b61*h_incimp + MG_b117*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   CORRUPTION
* Corruption: Investigated vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b8 + MG_b20*h_pinterest + MG_b26*h_leftright + MG_b32*h_gender + MG_b38*h_age + MG_b44*h_italian + MG_b50*(`a') ///
+ MG_b56*h_lyceum + MG_b62*h_honimp + MG_b118*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Corruption: Corrupt vs Clean sheet
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b7
generate x_betahat1 = MG_b9 + MG_b21*h_pinterest + MG_b27*h_leftright + MG_b33*h_gender + MG_b39*h_age + MG_b45*h_italian + MG_b51*(`a') ///
+ MG_b57*h_lyceum + MG_b63*h_honimp + MG_b119*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   TAX AND SPEND
* Taxspend: Maintain vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b11 + MG_b64*h_pinterest + MG_b68*h_leftright + MG_b72*h_gender + MG_b76*h_age + MG_b80*h_italian + MG_b84*(`a') ///
+ MG_b88*h_lyceum + MG_b92*h_taximp + MG_b100 + MG_b120*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b10
generate x_betahat1 = MG_b12 + MG_b65*h_pinterest + MG_b69*h_leftright + MG_b73*h_gender + MG_b77*h_age + MG_b81*h_italian + MG_b85*(`a') ///
+ MG_b89*h_lyceum + MG_b93*h_taximp + MG_b101 + MG_b121*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

**********   SAME SEX RIGHTS
* Same sex: Some rights vs Same rights
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b14 + MG_b66*h_pinterest + MG_b70*h_leftright + MG_b74*h_gender + MG_b78*h_age + MG_b82*h_italian + MG_b86*(`a') ///
+ MG_b90*h_lyceum + MG_b94*h_sseximp + MG_b109 + MG_b122*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace

* Taxspend: Less tax and spend vs More tax and spend
restore, not
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
local a=0 
while `a' <= 1{
{
generate x_betahat0 = MG_b13
generate x_betahat1 = MG_b15 + MG_b67*h_pinterest + MG_b71*h_leftright + MG_b75*h_gender + MG_b79*h_age + MG_b83*h_italian + MG_b87*(`a') ///
+ MG_b91*h_lyceum + MG_b95*h_sseximp + MG_b110 + MG_b123*h_survey

gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
}
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
local a=`a'+ 1
display "." _c 
} 

display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
gen MV = _n
save sim2.dta, replace

eclplot diff_hat diff_hi diff_lo MV, hor estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) ysca(noline) ytitle ("") xtitle(Marginal effect, size(3)) ///
ylabel(1 "Education (high v. jr: worker" 2 ": student" 3 "Education (university v. jr): worker" 4 ": student" 5 "Income (middle v. low): worker" 6 ": student" 7 "Income (high v. low): worker" 8 ": student" ///
9 "Corruption (investigated v. clean): worker" 10 ": student" 11 "Corruption (corrupt v. clean): worker" 12 ": student" 13 "Tax-spend (constant v. more): worker" 14 ": student" 15 "Tax-spend (less v. more): worker" 16 ": student" ///
17 "Same-sex rights (some v. same): worker" 18 ": student" 19 "Same-sex rights (none v. same): worker" 20 ": student", noticks labsize(2)) ///
xlabel(.5 "0.5" .25 "0.25" 0 -.25 "-0.25" -.5 "-0.5", noticks labsize(2)) xline(0, lcolor(black) lwidth(medthin)) saving(ME_student, replace)

graph combine ME_gender.gph ME_italian.gph ME_lyceum.gph ME_student.gph, graphregion(fcolor(white)) ycommon xcommon saving(Figure_A1, replace) imargin(0 0 0 0)
